package com.shop.cereshop.app.dl.logic.controller;

import com.shop.cereshop.app.service.order.CereShopOrderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Controller;

import java.util.List;

/**
 * @author: 况鑫威
 * @Date: 2021/7/13
 * @Time: 14:04
 * @ClassName: TimerController
 * @Description: com.shop.cereshop.app.dl.logic.controller
 */
@Controller
public class TimerController {
    @Autowired
    private CereShopOrderService cereShopOrderService;

    @Scheduled(cron = "0 */${fixedRate} * * * *")
    public void timer(){
//        System.out.println("我好帅:当前时间戳"+System.currentTimeMillis());
        List<Long> ids = cereShopOrderService.getOrderId();
        if (ids!=null && ids.size()>0){
            cereShopOrderService.updateState2(ids);
        }
    }


}
